<script type="text/javascript">
    $(function() {
        $.fn.dataGridOptions.formSubFun("#form",'/modules/user/score/goods/doVerify.html');
    });
</script>
<div class="popShow" style="padding-bottom:0">
        <div class="showItem">
            <span>商品名称：</span>${goods.name}
        </div>
        <div class="showItem">
            <span>商品类别：</span>${category.name}
        </div>
        <div class="showItem">
            <span>商品状态：</span><#if goods.status?? && goods.status == 0 >待审核
            <#elseif goods.status?? && goods.status == 1>审核通过<#elseif goods.status?? && goods.status == -1>审核未通过</#if>
        </div>
        <div class="showItem">
            <span>商品类型：</span><#if goods.type?? && goods.type == 0 >待上架
            <#elseif goods.type?? && goods.type == 1>上架<#elseif goods.type?? && goods.type == -1>下架</#if>
        </div>
        <div class="showItem">
            <span>所需积分：</span>${goods.score}
        </div>
        <div class="showItem">
            <span>市场价：</span>${goods.marketPrice}元
        </div>
        <div class="showItem">
            <span>商品库存：</span>${goods.store}件
        </div>
</div>
<form id="form" method="post">
<div class="popForm" style="padding-top:0;padding-bottom:0;">
	<div class="formitm">
		<label style="width:130px;" class="lab">商品图片：</label>
		<div style="margin-left:140px;color:#000;" class="ipt">
			<ul id="uploadPiclist" style="list-style: none; padding: 0; margin: 0;">
			<img style="width: 100px; height: 100px;" src="${image_server_url}${goods.picPath}" alt="">
              <!--  <#if picList?? && picList.size() gt 0 >
                 <#list picList as item>
                    <li data-mum="${item.id?c}">
                       <img style="width: 100px; height: 100px;"src="${item.picUrl}" alt="">
                    </li>
                </#list>
            </#if> -->
            </ul>
		</div>
	</div>
	
	<div class="formitm">
		<label style="width:130px;" class="lab">商品详情：</label>
		<div style="margin-left:140px;color:#000;border:1px solid #dedede;" class="ipt">
			<textarea id="description" name="description"  style="height:100px;">${(goods.description)?if_exists}</textarea>
		</div>
	</div>
	
	<div class="formitm">
		<label style="width:130px;" class="lab">商品属性信息：</label>
		<div style="margin-left:140px;color:#000;border:1px solid #dedede;" class="ipt">
			<textarea id="attribute" name="attribute"  style="height:100px;">${(goods.attribute)?if_exists}</textarea>
		</div>
	</div>
	
	<div class="formitm">
		<label style="width:130px;" class="lab">商品备注：</label>
		<div style="margin-left:140px;color:#000;" class="ipt">
			<textarea name="remark" style="width:500px;" class="easyui-validatebox" readonly maxlength="256">${goods.remark}</textarea>
		</div>
	</div>
</div>


<div class="popForm" style="padding-top:0;">
	<div class="formitm">
		<label style="width:130px;" class="lab">是否通过：</label>
		<div style="margin-left:140px;" class="ipt">
			<input type="radio" name="status" class="easyui-validatebox" value="1" data-options="required: true"/>通过
			<input type="radio" name="status" class="easyui-validatebox"  checked="checked" value="-1" data-options="required: true"/>不通过
		</div>
	</div>
	<div class="formitm">
		<label style="width:130px;" class="lab">备注：</label>
		<div style="margin-left:140px;" class="ipt">
			<textarea name="operatorRemark" class="w300 easyui-validatebox" data-options="required: true"></textarea>
		</div>
	</div>
	<input name="verifyToken" value="${verifyToken!}" type="hidden">
	<input name="id" value="${goods.id}" type="hidden"/>	
</div>
</form>
<!-- 编辑器 -->
<script type="text/javascript" src="/plugins/tinymce/tinymce.min.js"></script>
<script type="text/javascript" src="/plugins/uploadify/jquery.uploadify.js"></script>
<link rel="stylesheet" href="/plugins/uploadify/uploadify.css" type="text/css">
<script type="text/javascript">
// 编辑器调用
var tinymceEditor;
tinymce.init({
    mode : "textareas",
    theme : "modern",//定义显示类别
    language:'zh_CN',//设置语言
    plugins: "fullscreen code preview textcolor",
    theme_advanced_toolbar_location : "top",//定义工具栏的位置
    theme_advanced_toolbar_align : "left", //定义工具栏工具的对其方式
    selector: "#description",
    theme_advanced_statusbar_location : "bottom",//定义输入框下方是否显示状态栏，默认不显示
    theme_advanced_resizing : true,//定义是否可以改变输入窗口大小
    menubar: false,//菜单栏
    toolbar:"fullscreen code styleselect removeformat bold italic alignleft aligncenter alignright fontsizeselect forecolor backcolor imageButton",
    theme_advanced_toolbar_location : "top",//定义工具栏的位置
    theme_advanced_toolbar_align : "left",//定义工具栏工具的对其方式
    toolbar_items_size: 'small',//工具栏图标大小
    setup: function (editor) {
        tinymceEditor = editor;
        editor.addButton('imageButton', {
            icon: 'image',
            onclick: function () {
            	var imgUrl;
            	$.layer({
    			    type: 1,
    			    closeBtn: [0, true],
    			    title: '选择图片',
    			    area: ['550px', '450px'],
    			    border: [0],
    			    page : {
    			    	html:'<div class="uploaderBox"><div class="uploadList"><ul class="filelist"></ul></div><div class="statusBar"><span class="okBtn">确定</span><span><em id="files" name="file"></em></span></div></div>'
    			    }
    			});
            	//图片上传插件
           		$('#files').uploadify({
   	              fileObjName : 'upload',
   	              buttonClass:'uploadBtn',
   	              buttonText:'选择&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;',
   	              fileTypeDesc:'Image Files',
   	              fileTypeExts:'*.gif; *.jpg; *.png',
   	              fileSizeLimit:'500',
   	           	  width:80,
   	              height:32,
   	              swf:'/plugins/uploadify/uploadify.swf',
   	              uploader:image_server_url+"/upload/uploadifySave.html?nid=goods",
   	              onSelectError: function(file,errorCode,errorMsg){
   	                    if(errorCode==-110){
   	                    	layer.msg('上传的单张图片不能超过500K，请重新上传', 1, -1);
   	                    	return false;
   	                    }
   	                    else if(errorCode==-130){
   	                    	layer.msg('选择的文件类型跟设置的不匹配', 2, -1);
   	                    	return false;
   	                    }
   	              },
   	              onUploadSuccess:function(file,data, response) {
   	            	if(data!=null){
   	                	imgUrl = image_server_url+data;
   	                    $('.filelist').append("<li><a href='"+imgUrl+"' class='fileshow'><img src='"+imgUrl+"' width='110px' height='110px' /></a><i class='iconfont delImgUrl' title='点击删除图片'>&#xe628;</i></li>");
   	                }
   	              }
   	        	});
           		//确定并添加到编辑器
           		$(".okBtn").click(function(){
           			var img = "";
           			$(".filelist li a").each(function(){
           				img += $(this).html();
           			});
           			if(img != "" ){
           				//var img = '<img src="'+imgUrl+'" alt="">';
                        tinymceEditor.insertContent(img);
           			}
           			layer.closeAll();
           		})   
           		//删除图片
				  $(".delImgUrl").live("click",function(){
				    var _that = $(this);
				     $.ajax({
				       url : "/modules/user/score/goods/delPic.html?randomTime=" + (new Date()).getTime(),
				       dataType:'json',
				       data : {pathPic : $(this).prev().attr("src")},
				       success:function(data){
				          if(data.result){
				            _that.parents("li").remove();
				          }
				       }
				     })
				  })
            }
        });
    }, 
    statusbar  : false //控制底部状态栏是否显示
});

var tinymceEditor1;
tinymce.init({
    mode : "textareas",
    theme : "modern",//定义显示类别
    language:'zh_CN',//设置语言
    plugins: "fullscreen code textcolor image",
    theme_advanced_toolbar_location : "top",//定义工具栏的位置
    theme_advanced_toolbar_align : "left", //定义工具栏工具的对其方式
    selector: "#attribute",
    theme_advanced_statusbar_location : "bottom",//定义输入框下方是否显示状态栏，默认不显示
    theme_advanced_resizing : true,//定义是否可以改变输入窗口大小
    menubar: false,//菜单栏
    toolbar:"fullscreen code styleselect removeformat bold italic alignleft aligncenter alignright fontsizeselect forecolor backcolor imageButton",
    theme_advanced_toolbar_location : "top",//定义工具栏的位置
    theme_advanced_toolbar_align : "left",//定义工具栏工具的对其方式
    toolbar_items_size: 'small',//工具栏图标大小
    setup: function (editor) {
        tinymceEditor1 = editor;
        editor.addButton('imageButton', {
            icon: 'image',
            onclick: function () {
            	var imgUrl;
            	$.layer({
    			    type: 1,
    			    closeBtn: [0, true],
    			    title: '选择图片',
    			    area: ['550px', '450px'],
    			    border: [0],
    			    page : {
    			    	html:'<div class="uploaderBox"><div class="uploadList"><ul class="filelist"></ul></div><div class="statusBar"><span class="okBtn">确定</span><span><em id="files1" name="file1"></em></span></div></div>'
    			    }
    			});
            	//图片上传插件
           		$('#files1').uploadify({
   	              fileObjName : 'upload',
   	              buttonClass:'uploadBtn',
   	              buttonText:'选择&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;',
   	              fileTypeDesc:'Image Files',
   	              fileTypeExts:'*.gif; *.jpg; *.png',
   	              fileSizeLimit:'500',
   	           	  width:80,
   	              height:32,
   	              // uploadLimit:1000,
   	              swf:'/plugins/uploadify/uploadify.swf',
   	              uploader:image_server_url+"/upload/uploadifySave.html?nid=goods",
   	              onSelectError: function(file,errorCode,errorMsg){
   	                    if(errorCode==-110){
   	                    	layer.msg('上传的单张图片不能超过500K，请重新上传', 1, -1);
   	                    	return false;
   	                    }
   	                    else if(errorCode==-130){
   	                    	layer.msg('选择的文件类型跟设置的不匹配', 2, -1);
   	                    	return false;
   	                    }
   	              },
   	              onUploadSuccess:function(file,data, response) {
       	             	if(data!=null){
    	                	imgUrl = image_server_url+data;
       	                    $('.filelist').append("<li><a href='"+imgUrl+"' class='fileshow'><img src='"+imgUrl+"' width='110px' height='110px' /></a><i class='iconfont delImgUrl1' title='点击删除图片'>&#xe628;</i></li>");
       	                }
   	              }
   	        	});
           		//确定并添加到编辑器
           		$(".okBtn").click(function(){
           			var img = "";
           			$(".filelist li a").each(function(){
           				img += $(this).html();
           			});
           			if(img != "" ){
           				//var img = '<img src="'+imgUrl+'" alt="">';
                        tinymceEditor1.insertContent(img);
           			}
           			layer.closeAll();
           		}) 
           		
           		//删除图片
			  	$(".delImgUrl1").live("click",function(){
			    	var _that = $(this);
			     	$.ajax({
			       		url : "/modules/user/score/goods/delPic.html?randomTime=" + (new Date()).getTime(),
			       		data : {pathPic : $(this).prev().attr("src")},
			       		success:function(data){
			          		if(data.result){
			            		_that.parents("li").remove();
			          		}
			       		}
			     	})
			  	})
            }
        });
    },
    statusbar  : false //控制底部状态栏是否显示
});
    $(".fileshow").fancybox();
</script>
